Skip to content

feat(houyidb): add HouyiDB client - #893

Merged
jamesgao-jpg merged 2 commits into
zilliztech:mainfrom
huahaitao:houyidb-client
Nov 4, 2026
Merged

jamesgao-jpg merged 2 commits into
zilliztech:mainfrom
huahaitao:houyidb-client

Conversation

@huahaitao

Copy link
Copy Markdown
Contributor

Summary

Adds a HouyiDB client to VectorDBBench.

  • HouyiDB is a memory-first vector database with an HNSW index. It exposes:
    • a PostgreSQL-compatible pgwire endpoint with a compact BYTEA batch format (AUB1 for batch upserts, AVB1 for query vectors), and
    • an HTTP benchmark API for health, optimize, index status, scalar labels and id filters.
  • The client uses pgwire for unfiltered workloads (load + search) and HTTP for filtered cases. NumGE is translated to a strict filter_gt_id (int_value - 1) to preserve the benchmark's >= semantics.
  • Scalar labels are sent with the insert batch because only the HTTP data plane stores them.
  • A cold run requires starting HouyiDB on an empty data directory; HouyiDB has no client-side drop for the main collection, so drop_old logs a warning.

Registration:

  • DB.HouyiDB in clients/__init__.py (init_cls / config_cls / case_config_cls)
  • vectordbbench houyidb CLI command
  • houyidb optional-dependency extra: requests, psycopg[binary]>=3.1
  • README usage section

Test plan

  • make lint (black + ruff) passes
  • make unittest passes
  • pytest tests/test_houyidb.py tests/test_db_client_resolution.py (10 + 47 tests)
  • vectordbbench houyidb --host 127.0.0.1 --case-type Performance1536D50K --dry-run resolves the full task config
  • Offline unit tests cover AUB1/AVB1 layout, dim mismatch, registration, filter routing and label-aware insert routing

@sre-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: huahaitao
To complete the pull request process, please assign xuanyang-cn after the PR has been reviewed.
You can assign the PR to them by writing /assign @xuanyang-cn in a comment when ready.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@jamesgao-jpg jamesgao-jpg left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed at exact head 6b53dac5ef05a9105ac85d74310831f23208cdc3. Five findings are attached inline.

VERIFIED: 11 focused tests passed; the real CLI dry-run and normal result-JSON read/round-trip passed. Focused mocked reproductions checked failed-query accounting, configuration propagation, repeated-load isolation, and pgwire execution timeout behavior. HouyiDB server behavior was checked against official source at 7bc4f52f7c7632f8c78d60aacc105c3f9f1dc345. No live HouyiDB test or performance benchmark was run.

HouyiDB is a memory-first vector database with an HNSW index. It exposes
a PostgreSQL-compatible pgwire endpoint with a compact BYTEA batch format
for unfiltered upserts and searches, plus an HTTP benchmark API for scalar
labels, id filters, optimize and index status.

The client uses pgwire for unfiltered workloads and switches to HTTP for
filtered cases. NumGE is translated to a strict filter_gt_id so that the
benchmark's >= semantics are preserved. Scalar labels are sent with the
insert batch because only the HTTP data plane stores them.

Register DB.HouyiDB (client/config/case config), add the `houyidb`
optional dependency extra, the CLI command and README usage notes.
Offline unit tests cover payload encoding, registration, filter routing
and label-aware insert routing.
…imeout

- Propagate HTTP/pgwire search failures instead of returning an empty list,
  so failed requests are counted as failures rather than ultra-fast successes.
- Reject datasets whose metric is not COSINE: the server builds a cosine
  index, so L2/IP ground truth would be measured against a different distance.
- Enforce drop_old by rejecting a non-empty main index at construction time;
  the server has no remote drop, and silently loading on top of old rows
  contaminates the benchmark.
- Verify the server's effective hnsw_m/hnsw_ef_construction from
  /v1/index/status after load and before search; pgwire applies build
  parameters only from server startup flags, so a mismatched label aborts.
- Bound pgwire statement execution with a per-client watchdog that cancels
  (then closes) queries exceeding timeout_sec; connect_timeout alone did not
  limit query execution.
@huahaitao

Copy link
Copy Markdown
Contributor Author

Thanks for the detailed review — all five findings are addressed at e209a49 (rebased onto current main).

[P1] Search failures. Both transports now let request/transport errors propagate (_search_http and the pgwire search path). An empty list is returned only for a successful zero-hit response. Added regression tests for HTTP and pgwire failure propagation, plus a zero-hit success test, so the runner's failure accounting and retry path are restored.

[P1] Metric. The client rejects any dataset metric other than COSINE at construction: HouyiDB's main index is built with cosine, so L2/IP ground truth would otherwise be measured against a different distance. The CLI now exposes only COSINE. Tests cover L2 and IP rejection.

[P1] drop_old. drop_old=True now queries /v1/index/status and raises when hot_count + indexed_count + pending_count > 0, with instructions to restart from an empty data directory. The check runs at construction time because VectorDBBench constructs the client once per fresh load and pickles it into workers afterwards. Tests cover occupied and empty indexes. I also fixed the server-side startup self-check to use reserved IDs and remove its probes, so a freshly started server is genuinely empty; previously it retained three sample vectors, which also made the existing restart test pass for the wrong reason.

[P2] Build parameters. After load and before the first search/optimize, the client reads the effective hnsw_m, hnsw_ef_construction and distance_metric from /v1/index/status and aborts on mismatch or missing fields; the error names the required --pgwire-hnsw-m / --pgwire-hnsw-efc flags. The corresponding HouyiDB server change reports these fields and applies the pgwire flags at startup. --no-verify-build-params exists only as an explicit opt-out for older servers that do not report them, and it logs a warning. Tests cover match, mismatch, missing fields, and the opt-out.

[P2] pgwire timeout. timeout_sec now bounds statement execution, not just connection establishment. A per-client watchdog thread cancels in-flight statements (cancel_safe, with cancel() fallback on psycopg 3.1) and closes the connection if cancellation does not unblock; timed-out connections are discarded so the next call reconnects. The regression test blocks a statement after the connection is established and asserts TimeoutError plus cancellation/close.

Validation: 25 focused tests, black --check, and ruff pass; CLI dry-run passes; live smoke tests against a patched HouyiDB over both pgwire and HTTP pass, including drop_old rejection, build-parameter mismatch rejection, and WAL restart persistence. No benchmark numbers were produced or updated by this change.

@huahaitao

Copy link
Copy Markdown
Contributor Author

Friendly ping for a re-review. All five findings were addressed at e209a49 (rebased on current main); two of the original threads now show as outdated because the code changed. No CI workflows run on the fork branch, but the focused tests, black --check, ruff, CLI dry-run, and live pgwire/HTTP smoke tests all passed locally. Happy to adjust anything else you'd like to see.

/assign @XuanYang-cn

@jamesgao-jpg
jamesgao-jpg merged commit 9782fde into zilliztech:main Nov 4, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants